/*
 *  Gurr - A multiprotocol chat client for Android
 *  Copyright (C) 2011 Malte Aschermann, Wilfried Ramaker
 *  
 *  This file is part of Gurr.
 *  
 *  Gurr is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *  
 *  Gurr is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *  
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with Gurr.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.masc.gurr.view.activities;

import com.masc.gurr.Controller;
import com.masc.gurr.R;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class GurrActivity extends TabActivity {
    /** Called when the activity is first created. */
	private TabHost tabHost;
	
	@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Controller.getInstance().setGurrActivity(this);
        setContentView(R.layout.main);
        Resources res = getResources(); // Resource object to get Drawables
	    tabHost = getTabHost();  // The activity TabHost
	    TabHost.TabSpec spec;  // Resusable TabSpec for each tab
	    Intent intent;  // Reusable Intent for each tab
	    
	    intent = new Intent().setClass(this, AccountActivity.class);
	    spec = tabHost.newTabSpec("account").setIndicator("Account",
	                      res.getDrawable(R.drawable.ic_tab_account))
	                  .setContent(intent);
	    tabHost.addTab(spec);

	    intent = new Intent().setClass(this, ContactsActivity.class);
	    spec = tabHost.newTabSpec("contacts").setIndicator("Contacts",
	                      res.getDrawable(R.drawable.ic_tab_contacts))
	                  .setContent(intent);
	    tabHost.addTab(spec);
	    
	    
	    intent = new Intent().setClass(this, ChatsActivity.class);
	    spec = tabHost.newTabSpec("chats").setIndicator("Chats",
	                      res.getDrawable(R.drawable.ic_tab_chats))
	                  .setContent(intent);
	    tabHost.addTab(spec);
	    
	    tabHost.setCurrentTab(0);
    }
}